This AppleScript is intended to replicate VoodooPad's default HTML export behavior for the currently visible page. Its critical feature is the ability to correctly name the exported file so that other pages in your wiki will link to it properly.


set thePath to "/testwiki/"
-- it's important to set this path to the folder where
-- you'd like the resulting file to be saved, and don't
-- forget the trailing "/"

tell application "VoodooPad"
	set thePage to ""
	set thePage to the name of window 1 as text
	if thePage = "" then set thePage to the name of window 2 as text
	set theDoc to the name of document 1 as text
	set theDoc to theDoc & ":"
end tell

set x to the length of theDoc
repeat while thePage begins with the theDoc
	set thePage to characters (x + 1) thru -1 of thePage as string
end repeat

set the comparison_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set the source_string to "abcdefghijklmnopqrstuvwxyz"

set the newFile to ""
repeat with thisChar in thePage
	set x to the offset of thisChar in the comparison_string
	if x is not 0 then
		set the newFile to (the newFile & character x of the source_string) as string
	else
		set the newFile to (the newFile & thisChar) as string
	end if
end repeat

set AppleScript's text item delimiters to " "
set newFile to (text items of newFile)
set AppleScript's text item delimiters to "_20"
set newFile to newFile as text
set AppleScript's text item delimiters to ""
try
	set newFile to (characters 1 thru 23 of newFile)
end try
set newFile to (thePath & newFile & ".html") as text

tell application "VoodooPad"
	activate
	tell document 1
		export the page named thePage to newFile as HTML
	end tell
end tell

Script submitted by – mike [dot] com [at] mac [dot] com

Version History
(1Jun05) Fixed WindowShadeX bug